var write = function(args){
    console.log(args);
};

$(function(){
  //alert('hi');
  //$("#all_menu_items .accordion-group:first-child").find(".accordion-inner").remove();

  $(".btn-quant-minus").on("click",function(){
    var input_quant = $(this).parents(".order_form_wrapper").find(".order_amount"),
      curQuant = parseInt(input_quant.val());
    if (curQuant > 1 ){
      curQuant -= 1;
    }
    input_quant.val(curQuant);
  });
  $(".btn-quant-plus").on("click",function(){
    var input_quant = $(this).parents(".order_form_wrapper").find(".order_amount"),
      curQuant = parseInt(input_quant.val());
    if (curQuant < 2 ){
      curQuant += 1;
    }
    input_quant.val(curQuant);
  });

  $(".order_form").on("submit",function(e){
    var curQuant = parseInt($(this).find(".order_amount").val());
    if (curQuant != 1 && curQuant != 2) {
      alert("Plz order 1 or 2 portions");
      e.preventDefault();
    }
  });

  $(".back_button").on("click",function(){
    history.back();
  });
})